from faker import Faker
import openpyxl





def fake():
    suruima = []
    shahuang = Faker(locale='zh_CN')

    for i in range(100):
        phonenumber = shahuang.msisdn()
        name = shahuang.name()
        G = shahuang.email()

        username, domain = G.split('@')

        # 将域名部分替换为".git.cn"
        new_domain = "git.cn"
        email = f"{username}@{new_domain}"
        c = shahuang.city()
        d = shahuang.city_name()
        f = shahuang.country()
        e = shahuang.district()

        c.join(f)

        site = f + c + d + e

        jinjunzhiqiang = [[name, phonenumber, email, site]]

        suruima.extend(jinjunzhiqiang)
    return suruima


wb = openpyxl.load_workbook('user.xlsx')
sheet = wb.create_sheet('user')

for i in fake():
    sheet.append(i)

wb.save('user.xlsx')




